home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIDOMCanvasRenderingContext2D.idl < prev    next >
Text File  |  2006-05-08  |  6KB  |  159 lines

  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  *   Vladimir Vukicevic <vladimir@pobox.com>
  19.  * Portions created by the Initial Developer are Copyright (C) 2005
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39. #include "nsIVariant.idl"
  40.  
  41. interface nsIDOMWindow;
  42. interface nsIDOMHTMLImageElement;
  43. interface nsIDOMHTMLCanvasElement;
  44.  
  45. [scriptable, uuid(bbb20a59-524e-4662-981e-5e142814b20c)]
  46. interface nsIDOMCanvasGradient : nsISupports
  47. {
  48.   void addColorStop(in float offset, in DOMString color);
  49. };
  50.  
  51. [scriptable, uuid(21dea65c-5c08-4eb1-ac82-81fe95be77b8)]
  52. interface nsIDOMCanvasPattern : nsISupports
  53. {
  54. };
  55.  
  56. [scriptable, uuid(15487cf4-292b-49aa-bc36-17d9099f77a7)]
  57. interface nsIDOMCanvasRenderingContext2D : nsISupports
  58. {
  59.   // back-reference to the canvas element for which
  60.   // this context was created
  61.   readonly attribute nsIDOMHTMLCanvasElement canvas;
  62.  
  63.   // state
  64.   void save();
  65.   void restore();
  66.  
  67.   // transformations
  68.   void scale(in float x, in float y);
  69.   void rotate(in float angle);
  70.   void translate(in float x, in float y);
  71.  
  72.   // compositing
  73.   attribute float globalAlpha; /* default 1.0 -- opaque */
  74.   attribute DOMString globalCompositeOperation; /* default "over" */
  75.  
  76.   // colors and styles
  77.   attribute nsIVariant strokeStyle;
  78.   attribute nsIVariant fillStyle;
  79.  
  80.   nsIDOMCanvasGradient createLinearGradient (in float x0, in float y0, in float x1, in float y1);
  81.   nsIDOMCanvasGradient createRadialGradient(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1);
  82.   nsIDOMCanvasPattern createPattern(in nsIDOMHTMLImageElement image, in DOMString repetition);
  83.  
  84.   attribute float lineWidth; /* default 1 */
  85.   attribute DOMString lineCap; /* "butt", "round", "square" (default) */
  86.   attribute DOMString lineJoin; /* "round", "bevel", "miter" (default) */
  87.   attribute float miterLimit; /* default 10 */
  88.  
  89.   // shadows
  90.   attribute float shadowOffsetX;
  91.   attribute float shadowOffsetY;
  92.   attribute float shadowBlur;
  93.   attribute DOMString shadowColor;
  94.  
  95.   // rects
  96.   void clearRect(in float x, in float y, in float w, in float h);
  97.   void fillRect(in float x, in float y, in float w, in float h);
  98.   void strokeRect(in float x, in float y, in float w, in float h);
  99.  
  100.   // path API
  101.   void beginPath();
  102.   void closePath();
  103.  
  104.   void moveTo(in float x, in float y);
  105.   void lineTo(in float x, in float y);
  106.   void quadraticCurveTo(in float cpx, in float cpy, in float x, in float y);
  107.   void bezierCurveTo(in float cp1x, in float cp1y, in float cp2x, in float cp2y, in float x, in float y);
  108.   void arcTo(in float x1, in float y1, in float x2, in float y2, in float radius);
  109.   void arc(in float x, in float y, in float r, in float startAngle, in float endAngle, in boolean clockwise);
  110.   void rect(in float x, in float y, in float w, in float h);
  111.  
  112.   void fill();
  113.   void stroke();
  114.   void clip();
  115.  
  116.   // image api
  117.   void drawImage();
  118. /*
  119.   void drawImage(in HTMLImageElement image, in float dx, in float dy);
  120.   void drawImage(in HTMLImageElement image, in float dx, in float dy, in float sw, in float sh);
  121.   void drawImage(in HTMLImageElement image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
  122. */
  123.  
  124.   /**
  125.    * Renders a region of a window into the canvas.  The contents of
  126.    * the window's viewport are rendered, ignoring viewport clipping
  127.    * and scrolling.
  128.    *
  129.    * @param x
  130.    * @param y
  131.    * @param w
  132.    * @param h specify the area of the window to render, in CSS
  133.    * pixels.
  134.    *
  135.    * @param backgroundColor the canvas is filled with this color
  136.    * before we render the window into it. This color may be
  137.    * transparent/translucent. It is given as a CSS color string
  138.    * (e.g., rgb() or rgba()).
  139.    *
  140.    * Of course, the rendering obeys the current scale, transform and
  141.    * globalAlpha values.
  142.    *
  143.    * Hints:
  144.    * -- If 'rgba(0,0,0,0)' is used for the background color, the
  145.    * drawing will be transparent wherever the window is transparent.
  146.    * -- Top-level browsed documents are usually not transparent
  147.    * because the user's background-color preference is applied,
  148.    * but IFRAMEs are transparent if the page doesn't set a background.
  149.    * -- If an opaque color is used for the background color, rendering
  150.    * will be faster because we won't have to compute the window's
  151.    * transparency.
  152.    *
  153.    * This API cannot currently be used by Web content. It is chrome
  154.    * only.
  155.    */
  156.   void drawWindow(in nsIDOMWindow window, in long x, in long y,
  157.                   in long w, in long h, in DOMString bgColor);
  158. };
  159.